package walmdach;

import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;
import com.jme3.scene.shape.Box;
import java.util.ArrayList;
import java.util.List;

/**
 * test
 * @author normenhansen
 */
public class Main extends SimpleApplication {

    public static void main(String[] args) {
        Main app = new Main();
        app.start();
    }

    @Override
    public void simpleInitApp() {
        
        Point[] points = new Point[4];
              
        points[0] = new Point(1,1,1);
        points[1] = new Point(1,2,1);
        points[2] = new Point(2,2,1);
        points[3] = new Point(2,1,1);
        
        
        Edge[] edges = new Edge[4];
        
        edges[0] = new Edge(30.0, points[0], points[1]);
        edges[1] = new Edge(30.0, points[1], points[2]);
        edges[2] = new Edge(30.0, points[2], points[3]);
        edges[3] = new Edge(30.0, points[3], points[0]);
        
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Blue);
        List<Geometry> geoms = new ArrayList<Geometry>();

        for (Edge edge : edges) {
            Geometry geom = new Geometry("Line", edge.toLine());
            geom.setMaterial(mat);
            rootNode.attachChild(geom);
            geoms.add(geom);
        }
    }

    @Override
    public void simpleUpdate(float tpf) {
        //TODO: add update code
    }

    @Override
    public void simpleRender(RenderManager rm) {
        //TODO: add render code
    }
}
